package com.rwx.reflect;

import com.rwx.reflect.model.Student;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;

public class Reflect04 {

    public static void main(String[] args) throws ClassNotFoundException,
            NoSuchMethodException,
            InvocationTargetException,
            InstantiationException, IllegalAccessException, NoSuchFieldException {
        Class clazz=Class.forName("com.rwx.reflect.model.Student");
        Constructor con1 = clazz.getConstructor();
        Field[] fields = clazz.getFields();
        for (Field f:fields){
            System.out.println(f);
        }
        System.out.println("=============================");
        Field[] fields01 = clazz.getDeclaredFields();
        for (Field f:fields01){
            System.out.println(f);
        }
        System.out.println("=============================");
        Field gender = clazz.getField("gender");
        System.out.println(gender);
        System.out.println("=============================");
        Field name = clazz.getDeclaredField("name");
        System.out.println(name);
        System.out.println("=============================");




    }
}
